package com.weng.cloud.service8881.jdk8;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author: weng
 * @Date: 2022/5/15
 * @Description: com.weng.cloud.service8881.jdk8
 */

public class TestArrays {

    static int[] arr = new int[5];

    public static void main(String[] args) {
//        testFill();
        testStream();
    }

    static void testFill(){
        // [0, 0, 0, 0, 0]
        System.out.println(Arrays.toString(arr));
        Arrays.fill(arr,-100);
        // [-100, -100, -100, -100, -100]
        System.out.println(Arrays.toString(arr));
    }

    static void testStream(){
        List<Integer> integers = Arrays.stream(arr).parallel().boxed().limit(3).collect(Collectors.toList());
        System.out.println(integers);
    }
}
